<?php 
$user=$session->read('User');
$companyid=$session->read("companyid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
		<?php 
		$companyname=$session->read("companyname");		
		//$companyyear=$session->read("economicyear");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid)."&nbsp;"."&nbsp;".'研发费用投入清单';
		?>
    	</h2>
    	<div class='clear'></div>
    </div>
    <div class="right item_add_btn">
		<?php 			
			$cuser=$session->read('User');
			if($form->value('DevelopmentList.id')){
			$str_title=__("Edit",true);
			}else{
			$str_title=__("Add",true);
			}
    		echo $html->link(__("Cancel",true).$str_title,"/companys/deplist/",array("onclick"=>"history.go(-1);return false;"));
    	?>
	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<?php 
		echo $form -> create('DevelopmentList', array('url'=>'/companys/editdeplist','enctype'=>'multipart/form-data','onsubmit'=>"return checkdinfo()") ); 
		?>
		<div class="items_list">
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">项目名称：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('DevelopmentList.name',array("maxlength"=>"100"));?>
					</div>
					<div id='namemsg' style='display:none;' class="error_message">请输入项目名称</div>
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">起始日期：</div>
					<div class="form_right_e_input form_date_picker left">
						<?php echo $form->text('DevelopmentList.start_date',
												array("maxlength"=>"10","onfocus"=>"WdatePicker()","style"=>"width:130px"));?>
					</div>
					<div id='sdatemsg' style='display:none;' class="error_message">请输入起始日期</div>
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">完成日期：</div>
					<div class="form_right_e_input form_date_picker left">
						<?php echo $form->text('DevelopmentList.finish_date',
												array("maxlength"=>"10","onfocus"=>"WdatePicker()","style"=>"width:130px"));?>
					</div>
					<div id='fdatemsg' style='display:none;' class="error_message">请输入完成日期</div>
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">所处阶段：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('DevelopmentList.stage',array("maxlength"=>"100"));?>
					</div>
					
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">预期投入：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('DevelopmentList.ex_investment',array("placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?> ￥	
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">项目投入：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('DevelopmentList.act_investment',array("placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?> ￥
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">累计投入：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('DevelopmentList.total_investment',array("placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?> ￥	
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
				    <div class="form_left_title left">是否备案：</div>
				    <div class="form_right_e_input left">
				    	<?php 
				        	$radiovalue=array("1"=>"是","0"=>"否");
				         	$attributes=array('legend'=>false,'default'=>'0');
				        ?>
				    	<?php echo $form->radio('DevelopmentList.record',$radiovalue,$attributes);?>
				    </div>
				</div>
			</div> 
			<div class="details_item_line">
				<div class="details_item">
				   <div class="form_left_title left">附件：</div>
				    <div class="form_right_input left">
				 		<?php if($attachments){?>
	                	<div class="file_category_list">
			        		<div id="filelist0" class="file_lists">
			        			<ul class="file_attach">
				                	<?php
				                	$dan="'";
				                	foreach($attachments as $attachment) {
											echo "<li>";
											echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
											echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";									
											echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';									
											echo "</li>";
									}
				                	?>
				                </ul>
			                </div>
			            </div>
			            <?php }?>
					    <div id="add1" class="left text_box"> 
							<div class="file_add_box">
								<input type="file" id="upload[]" name="upload[]" />
							</div>
						</div>
						<div class="clear"></div>
						<div id="add2" class="left filelist"></div>
						<div class="left clear">
							<div class="left add_sub_file_btn">
								<span onclick="add()" href="#"><?php echo $html->image('list-add.png')?></span>&nbsp;
								<span onclick="remove()" href="#"><?php echo $html->image('list-remove.png')?></span>
						</div>
					</div>
				 </div>
				</div>
			</div>
			<?php
			//echo $form->hidden('DevelopmentList.owner',array('value' => $cuser['id'])) ;		
			echo $form->hidden('DevelopmentList.cid',array('value' => $_SESSION['companyid'])) ;
			?>
		 	<?php
		    echo $form->hidden('DevelopmentList.id') ;
			?>
			<div class="details_item_line edit_form_btn">
	            <div class="details_item">
	            	<div class="form_left_title left"></div>
	                <div class="form_add_submit left">
						<?php echo $form->submit(__('Save',true), array("id"=>"adduser","name"=>"submit","class"=>"buttom","div"=>false)) ?>
						 <?php  echo $form->hidden('DevelopmentList.id'); ?>
					</div>
	            </div>
       		 </div>
		</div>
	</div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>
<script>
function checkdinfo(){
	if($("#DevelopmentListName").val().trim() == ''){
		$("#namemsg").css('display','block');
		return false;
	}else{
		$("#namemsg").css('display','none');
	}
	
	if($("#DevelopmentListStartDate").val().trim() == ''){
		$("#sdatemsg").css('display','block');
		return false;
	}else{
		$("#sdatemsg").css('display','none');
	}
	
	if($("#DevelopmentListFinishDate").val().trim() == ''){
		$("#fdatemsg").css('display','block');
		return false;
	}else{
		$("#fdatemsg").css('display','none');
	}
}
</script>	